var a = getApp();

Page({
    data: {},
    onLoad: function(a) {
        this.setData({
            teamId: wx.getStorageSync("teamId"),
            token: wx.getStorageSync("log")
        });
    },
    onShow: function() {
        var t = this;
        wx.showLoading({
            title: "加载中...",
            mask: !0
        }), wx.request({
            url: a.globalData.dic + "doctor/team/detail/" + t.data.token + "/" + t.data.teamId,
            success: function(a) {
                if (console.log(a), 200 == a.data.code) {
                    wx.hideLoading();
                    var e = a.data.data.createTime.split(" ");
                    a.data.data.createTime = e[0], t.setData({
                        detailList: a.data.data,
                        img: a.data.data.teamHeaderUrl
                    }), console.log(t.data.detailList);
                }
            }
        });
    },
    serve: function(a) {
        wx.setStorageSync("teamId", this.data.teamId), wx.navigateTo({
          url: "/hyb_yl/index/notice1/notice1"
        });
    },
    list: function(a) {
        wx.navigateTo({
          url: "/hyb_yl/index/list/list?teamId=" + this.data.teamId
        });
    },
    clickname: function(a) {
        wx.navigateTo({
          url: "/hyb_yl/index/teamDetails1/teamDetails1"
        });
    },
    clicknameText: function(a) {
        wx.navigateTo({
          url: "/hyb_yl/index/teamDetails2/teamDetails2"
        });
    },
    member: function(a) {
        wx.navigateTo({
          url: "/hyb_yl/index/teamDetails3/teamDetails3"
        });
    },
    Wimg: function(t) {
        var e = this, o = (wx.getStorageSync("log"), wx.getStorageSync("teamId") || "");
        wx.chooseImage({
            count: 1,
            sizeType: [ "orignal", "compressed" ],
            sourceType: [ "album", "camera" ],
            success: function(t) {
                console.log(t.tempFilePaths[0]), e.setData({
                    img: t.tempFilePaths[0]
                });
                var i = wx.getStorageSync("log") || "";
                wx.uploadFile({
                    url: a.globalData.dic + "doctor/team/update/" + i,
                    filePath: t.tempFilePaths[0],
                    name: "file",
                    formData: {
                        teamId: o,
                        flag: 1
                    },
                    method: "POST",
                    header: {
                        "Content-Type": "multipart/form-data"
                    },
                    success: function(a) {
                        console.log(a);
                    }
                });
            }
        });
    },
    navCode: function(a) {
        wx.navigateTo({
          url: "/hyb_yl/index/teamDetails4/teamDetails4"
        });
    },
    shanchu: function(t) {
        var e = this;
        wx.showModal({
            title: "提示",
            content: "您确认解散团队吗？",
            success: function(t) {
                t.confirm ? wx.request({
                    url: a.globalData.dic + "doctor/team/break",
                    data: {
                        token: e.data.token,
                        teamId: e.data.teamId
                    },
                    method: "POST",
                    header: {
                        "Content-Type": "application/x-www-form-urlencoded"
                    },
                    success: function(a) {
                        console.log(a.data), 200 == a.data.code && wx.navigateBack({
                            delta: 2
                        });
                    }
                }) : t.cancel && console.log("用户点击取消");
            }
        });
    },
    invitation: function(a) {
        wx.navigateTo({
          url: "/hyb_yl/index/teamDetails5/teamDetails5"
        });
    }
});